#include "gtest/gtest.h"

#include "predictor_const_v.h"
#include "predictor_link.h"

using namespace std;

TEST( Predictors, const_v )
{
  Predictor_base *p = new Predictor_const_v( "TEST" );

  Predictor_link *l_in_v = p->get_input_link( 0 );
  Predictor_link *l_in_p = p->get_input_link( 1 );

  l_in_v->set_value( 2.2 );
  l_in_p->set_value( 0.0 );

//  p->save_state( 0.0 );
  p->predict( 1.0 );
  ASSERT_NEAR( p->get_predicted_input(0), 2.2, 0.000001 ); // velocity
  ASSERT_NEAR( p->get_predicted_input(1), 2.2, 0.000001 ); // position

  l_in_v->set_value( 1.0 );

  p->predict( 1.5 );
  ASSERT_NEAR( p->get_predicted_input(0), 1.0, 0.000001 ); // velocity
  ASSERT_NEAR( p->get_predicted_input(1), 1.5, 0.000001 ); // position
}
